/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PagoCliente.java
 *
 * Created on 21/05/2011, 02:30:50 PM
 */

package GUI;

import Interfaz.InterfazControl;
import Motor.Cliente;
import Motor.Empleado;
import Motor.Producto;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ImageIcon;

/**
 *
 * @author Vane
 */
public class PagoCliente extends javax.swing.JFrame {

    /** Creates new form PagoCliente */
	private Cliente datosCliente = new Cliente();
	private InterfazControl laInterfaz;
	private List <Producto> productosSeleccionados = new ArrayList<Producto>();
	private Empleado datoEmpleado=new  Empleado();

    public PagoCliente(InterfazControl laInterfaz, Cliente cliente, List<Producto> productos,Empleado empleado)
	{
		this.laInterfaz=laInterfaz;
        initComponents();
		datoEmpleado=empleado;
		datosCliente = cliente;
		productosSeleccionados= productos;
		this.setLocationRelativeTo(null); // Cmabiar icono de java en ventana
        this.setIconImage(new ImageIcon("src/imagenes/marketplus2.png").getImage());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jToggleButtonProcesarPago = new javax.swing.JToggleButton();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTableTiposPagos = new javax.swing.JTable();
        jTVuelto = new javax.swing.JTextField();
        jTTotal = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(450, 350));
        setResizable(false);
        getContentPane().setLayout(null);

        jLabel1.setText("Total BsF:");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(10, 110, 80, 14);

        jLabel2.setText("Vuelto BsF:");
        getContentPane().add(jLabel2);
        jLabel2.setBounds(10, 140, 90, 14);

        jToggleButtonProcesarPago.setText("Imprimir Factura");
        jToggleButtonProcesarPago.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButtonProcesarPagoActionPerformed(evt);
            }
        });
        getContentPane().add(jToggleButtonProcesarPago);
        jToggleButtonProcesarPago.setBounds(10, 200, 170, 73);

        jLabel3.setFont(new java.awt.Font("Tempus Sans ITC", 1, 14));
        jLabel3.setText("Registro de Pagos");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(150, 10, 140, 30);

        jTableTiposPagos.setFont(new java.awt.Font("Tahoma", 1, 11));
        jTableTiposPagos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"Tarjeta", null, null},
                {"Cheque", null, null},
                {"CestaTicket", null, null},
                {"Efectivo", null, null},
                {null, null, null}
            },
            new String [] {
                "Tipo de Pagos", "Codigo", "Monto"
            }
        ));
        jScrollPane1.setViewportView(jTableTiposPagos);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(190, 50, 240, 220);

        jTVuelto.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTVueltoKeyTyped(evt);
            }
        });
        getContentPane().add(jTVuelto);
        jTVuelto.setBounds(80, 140, 80, 20);

        jTTotal.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                jTTotalKeyTyped(evt);
            }
        });
        getContentPane().add(jTTotal);
        jTTotal.setBounds(80, 110, 80, 20);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/marketplus.png"))); // NOI18N
        getContentPane().add(jLabel4);
        jLabel4.setBounds(10, 0, 94, 80);

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
        jLabel5.setText("RIF: J-122231245          Desarrollado por: Group Delivery");
        getContentPane().add(jLabel5);
        jLabel5.setBounds(80, 290, 320, 13);

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void jTTotalKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTTotalKeyTyped
		// TODO add your handling code here:
		char c = evt.getKeyChar();
             if (Character.isDigit(c)== false)
                 evt.consume();
	}//GEN-LAST:event_jTTotalKeyTyped

	private void jTVueltoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTVueltoKeyTyped
		// TODO add your handling code here:
		char c = evt.getKeyChar();
             if (Character.isDigit(c)== false)
                 evt.consume();
	}//GEN-LAST:event_jTVueltoKeyTyped

	private void jToggleButtonProcesarPagoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButtonProcesarPagoActionPerformed
		// TODO add your handling code here:

		
		Factura iraFactura =new Factura(laInterfaz,datosCliente,productosSeleccionados,"",datoEmpleado);
		iraFactura.setVisible(true);
		this.dispose();
	}//GEN-LAST:event_jToggleButtonProcesarPagoActionPerformed

    /**
    * @param args the command line arguments
    */
   

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField jTTotal;
    private javax.swing.JTextField jTVuelto;
    private javax.swing.JTable jTableTiposPagos;
    private javax.swing.JToggleButton jToggleButtonProcesarPago;
    // End of variables declaration//GEN-END:variables

}
